<?php
/*
* @Date: 2021-03-01 22:04:12
* @名称: app_info 数据库管理
* @版本: 0.01
* @作者: 初雪桜
* @邮箱: 202184199@qq.com
* @最后编辑: 初雪桜
 * @LastEditTime: 2021-03-07 19:54:19
 * @FilePath: /Site/app/useradmin/controller/DataBaseController/AppInfo.php
*/

namespace app\useradmin\controller\DataBaseController;

use think\facade\Db;

class AppInfo
{

    /**
     * @方法名: 查询漫画数据
     * @作者: 初雪桜
     * @信息: 查询漫画数据
     * @param {*} $page 第几页
     * @param {*} $pageNumber 一页显示几个
     * @param {*} $where 搜索条件
     * @return Json
     */
    public function Select($page = 1, $pageNumber = null, $where = [])
    {
        $count = Db::table("app_info")
            ->alias("app_info")
            ->order("app_info.id desc")
            ->where($where)
            ->join("user_info user_info", "user_info._id = app_info.update_user_id")
            ->count();
        $AppList =  Db::table("app_info")
            ->alias("app_info")
            ->order("app_info.id desc")
            ->join("user_info user_info", "user_info._id = app_info.update_user_id")
            ->where($where)
            ->limit($page * $pageNumber - $pageNumber, $pageNumber)
            ->field([
                "app_info.id",
                "app_info._id as uuid_id",
                "app_info.update_info",
                "app_info.platform",
                "app_info.version",
                "app_info.build_version",
                "app_info.uorce_update",
                "app_info.minimum_version_number",
                "app_info.download_url",
                "app_info.disable",
                "app_info.disable_info",
                "app_info.update_user_id",
                "app_info.upload_time",
                "user_info.name as user_name",
            ])
            ->select();
        return json_decode(successJsonReturn([
            "AppList" => $AppList,
            "Count" => $count,
        ])->getContent(), true);
    }

}
